<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/FCKeditor.tld" prefix="fck" %>
<%@page import="java.util.*,model.*,util.*,control.*"%>
<!DOCTYPE html>
<html>
<head>
    <title>开始考试</title>
    <meta charset="utf-8"/>
    <script  src='../../js/core.js'></script>
    <link type="text/css" rel='stylesheet' href="../../css/info2.css"/>
</head>
<body>
 		<%
           /*
           *验证权限
           *author 宋智洋
           *data 2011-11-26
           *update 胡瑾
           *data 2011-12-01
           *增加了userId
           */
			String flag = (String)session.getAttribute("flag");
			String userId = (String)session.getAttribute("userId");
			int studentId = Integer.parseInt(userId);
						
			if (flag != "student"|| flag==null )
			{
				%>
            <script language="javascript">
				     alert("您没有学生权限,请重新登录"); window.location.href="../../index.jsp";
				    </script>
            <%
				
			}else{
				Student student = new Student();
				StudentControl sc = new StudentControl();
				student = sc.GetStudent(studentId);
				//out.print("<p>"+student.getStudentName()+"   欢迎您</p>");
			}
           %>
         
   
      
      <%
			//这个页是首页,也就是为了选取第一题,并且传第一题的参数而设置的页,之后不会用到.
			
			int n=1;//n是对题目进行计数,n初值为1,说明已经做了一道题了
			double cita=0.0;//cita为能力值的估计,初值为0
			double ffirst=0;//f的一次导叠加
			double fsecond=0;//f的二次导叠加
			request.setCharacterEncoding("utf-8");//utf-8的编码方式
			Problem problem = new Problem();
			ProblemControl pc = new ProblemControl();
			
			/*
			选择第一题
			@author vinllen
			2011-12-6
			@update 宋智洋 添加判重
			*/
			List<Integer> idList = new ArrayList<Integer>();
			
			others fi = new others();
			int markMax = fi.getMaxId();
			//System.out.println("最大题数" + markMax);
			int proNr = fi.choseProble(markMax);
			
			int id=proNr;//直接选择题库中的第一题 作为显示的第一题
			idList.add(id);
			session.setAttribute("idList", idList);
			
			problem = pc.GetProblem(id);//通过id获取题目
			//System.out.println(id);
			
			
			/*获取系统时间
			by vinllen
			2011-11-27
			*/
			Calendar ca = Calendar.getInstance();  
			int year = ca.get(Calendar.YEAR);//获取年份  
			int month=ca.get(Calendar.MONTH) + 1;//获取月份   
			int day=ca.get(Calendar.DATE);//获取日  
			int minute=ca.get(Calendar.MINUTE);//分   
			int hour=ca.get(Calendar.HOUR);//小时
			int second=ca.get(Calendar.SECOND);//秒  
			
			String nowDate = year + "-" + month+ "-" + day + "-"+ hour + ":" + minute + ":" + second;
			String startDate = nowDate;
			//System.out.println("nowDate ++ " + nowDate);
		%>
    
      <!--将id n cita 一阶导 二阶导 传给problem_chuli 以便判断下一题-->
      <!--  下面一行添加nowDate-->
<div id="page">
<header class="header">
    <p class="title">欢迎您注册CAT测评系统</p>
</header>
	<section class="main" style='margin-top:10px;'>
      <form name="form1" method="post" action="problem_chuli.jsp?id=<%=id%>&amp;n=<%=n%>&amp;cita=<%=cita%>&amp;ffirst=<%=ffirst%>&amp;fsecond=<%=fsecond%>&amp;nowDate=<%=nowDate%>&amp;startDate=<%=startDate%>">
        <table width="100%">
          <tr>
            <td><%=n+"."+problem.getContent()%></td>
          </tr>
          <tr>
            <td>
              <input width="10px" name="choose" type="radio" value="A"/>
              A. <%=problem.getA()%></td></tr><tr>
            <td><input type="radio" name="choose" value="B"/>
              B. <%=problem.getB()%></td></tr><tr>
            <td><input type="radio" name="choose" value="C"/>
              C. <%=problem.getC()%></td></tr><tr>
            <td><input type="radio" name="choose" value="D"/>
              D. <%=problem.getD()%></td></tr><tr>
        </table>
         <p class='paragraph'>区分度 <%=problem.getAa()%></p>
         <p class='paragraph'>难度<%=problem.getBb()%></p>
         <p class='paragraph'>猜测系数 <%=problem.getCc()%></p>
         <br/><br/>
        <p style='padding-bottom:200px;'><input type='submit' class='btns fl br3' value='下一题'/>
      	<input type="button" onclick="javascript:window.history.go(-1)" class="btns fr br3" value="返   回"/></p>
	</form>
	</sction>    
	<footer class="footer"><small>© 2012 Nenu</small></footer>
</div>
</body>
</html>
